package com.neusoft.demo9;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class ExceptionDemo3 {
    //throws的作用：m1方法有可能会产生Exception异常，在这个方法中不用处理，而是由方法的调用者来处理该异常
    public void m1() throws IOException {
        FileInputStream fis = new FileInputStream("test.txt");
        fis.read();
    }
    public static void main(String[] args) {
        ExceptionDemo3 demo3 = new ExceptionDemo3();
        try {
            demo3.m1();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
}
